package com.controller.back;

import com.entity.Order;
import com.github.pagehelper.PageInfo;
import com.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("back/order")
public class OrderController {
    @Autowired
    private OrderService orderService;
    @RequestMapping("show")
    public String showAllOrder(@RequestParam(defaultValue = "1")Integer pageNum,
                               @RequestParam(defaultValue = "3")Integer pageSize,
                               HttpServletRequest req, Model model){
        PageInfo<Order> orders = orderService.selectPageOrder(pageNum, pageSize);
        req.setAttribute("orders",orders);
        return "forward:/back/order/show.jsp";
    }
}
